﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IDAL;
using DAL;
using Model;

namespace DAL
{
    public class DALTBLogins : IDALTBLogins
    {
        private Model1 db = new Model1();
        public bool Create(TBLogins logins)
        {
            var mo = db;
            mo.TBLogins.Add(logins);
            return db.SaveChanges()>0;
        }

        public bool SelectMobileNumber(string MobileNumber)
        {
           return db.TBLogins.Any(a => a.MobileNumber == MobileNumber);

        }

        public TBLogins SelectTiao(string Password, string UserName)
        {
            var a1= db.TBLogins.SingleOrDefault(a => a.Password == Password && a.UserName == UserName);
            return a1;
        }

        public bool SelectUserName(string UserName)
        {
            return db.TBLogins.Any(a => a.UserName == UserName);
        }
    }
}
